<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::get('login', 'LoginController@showLoginForm')->name('admin.login');
Route::post('login', 'LoginController@login');
Route::get('logout', 'LoginController@logout');
Route::post('logout', 'LoginController@logout');

//Route::get('/', 'IndexController@index');


Route::get('index', ['as' => 'admin.index', 'uses' => function () {
    return redirect('/admin/setting/welcome');
}]);


//Route::get('product.index', ['as' => 'admin.product.index', 'uses' => function () {
//    return redirect('/admin/product');
//}]);

Route::group(['middleware' => ['auth:admin', 'menu', 'authAdmin']], function () {

    //------------------------------------权限管理-------------------------------------------------------//

    Route::get('permission/{cid}/create', ['as' => 'admin.permission.create', 'uses' => 'PermissionController@create']);
    Route::get('permission/manage', ['as' => 'admin.permission.manage', 'uses' => 'PermissionController@index']);
    Route::get('permission/{cid?}', ['as' => 'admin.permission.index', 'uses' => 'PermissionController@index']);
    Route::post('permission/index', ['as' => 'admin.permission.index', 'uses' => 'PermissionController@index']); //查询
    Route::resource('permission', 'PermissionController', ['names' => ['update' => 'admin.permission.edit', 'store' => 'admin.permission.create']]);


    //------------------------------------角色管理---------------------------------------------------//

    Route::get('role/index', ['as' => 'admin.role.index', 'uses' => 'RoleController@index']);
    Route::post('role/index', ['as' => 'admin.role.index', 'uses' => 'RoleController@index']);
    Route::resource('role', 'RoleController', ['names' => ['update' => 'admin.role.edit', 'store' => 'admin.role.create']]);


    //------------------------------------用户管理-----------------------------------------------//

    Route::get('user/index', ['as' => 'admin.user.index', 'uses' => 'UserController@index']);  //用户管理
    Route::post('user/index', ['as' => 'admin.user.index', 'uses' => 'UserController@index']);
    Route::resource('user', 'UserController', ['names' => ['update' => 'admin.role.edit', 'store' => 'admin.role.create']]);



    //-------------------------------------产品--------------------------------------------------//
         // 产品模块
        Route::get('product', ['as' => 'admin.product', 'uses' => 'ProductController@index']);
        // 产品列表(展示页)
        Route::get('product/index', ['as' => 'admin.product.index', 'uses' => 'ProductController@index']);
        // 产品详情展示页
        Route::get('product/show/{id}', ['as' => 'admin.product.show', 'uses' => 'ProductController@show']);
        // 新建产品审核
        Route::any('product/create', ['as' => 'admin.product.create', 'uses' => 'ProductController@create']);
        // 修改产品详情审核
        Route::any('product/edit/{id}', ['as' => 'admin.product.edit', 'uses' => 'ProductController@edit']);
        // 产品上线
        Route::get('product/online/{id}', ['as' => 'admin.product.online', 'uses' => 'ProductController@online']);
        // 产品下线
        Route::get('product/offline/{id}', ['as' => 'admin.product.offline', 'uses' => 'ProductController@offline']);
        // 产品上线
        Route::get('product/onstate/{id}', ['as' => 'admin.product.onstate', 'uses' => 'ProductController@onstate']);
        // 产品下线
        Route::get('product/offstate/{id}', ['as' => 'admin.product.offstate', 'uses' => 'ProductController@offstate']);

    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('maverison', ['as' => 'admin.maverison', 'uses' => 'MaHomeController@index']);
    // 产品列表(展示页)
    Route::get('maverison/index', ['as' => 'admin.maverison.index', 'uses' => 'MaHomeController@index']);
    // 新建产品审核
    Route::any('maverison/create', ['as' => 'admin.maverison.create', 'uses' => 'MaHomeController@create']);
    // 修改产品详情审核
    Route::any('maverison/edit/{id}', ['as' => 'admin.maverison.create', 'uses' => 'MaHomeController@edit']);
    // 产品上线
    Route::get('maverison/online/{id}', ['as' => 'admin.maverison.online', 'uses' => 'MaHomeController@online']);
    // 产品下线
    Route::get('maverison/offline/{id}', ['as' => 'admin.maverison.offline', 'uses' => 'MaHomeController@offline']);


    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('version', ['as' => 'admin.version', 'uses' => 'VersionController@index']);
    // 产品列表(展示页)
    Route::get('version/index', ['as' => 'admin.version.index', 'uses' => 'VersionController@index']);
    // 新建产品审核
    Route::any('version/create', ['as' => 'admin.version.create', 'uses' => 'VersionController@create']);
    // 修改产品详情审核
    Route::any('version/edit/{id}', ['as' => 'admin.version.edit', 'uses' => 'VersionController@edit']);
    // 产品上线
    Route::get('version/online/{id}', ['as' => 'admin.version.online', 'uses' => 'VersionController@online']);
    // 产品下线
    Route::get('version/offline/{id}', ['as' => 'admin.version.offline', 'uses' => 'VersionController@offline']);

    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('recommand', ['as' => 'admin.recommand', 'uses' => 'RecommandController@index']);
    // 产品列表(展示页)
    Route::get('recommand/index', ['as' => 'admin.recommand.index', 'uses' => 'RecommandController@index']);
    // 新建产品审核
    Route::any('recommand/create', ['as' => 'admin.recommand.create', 'uses' => 'RecommandController@create']);
    // 修改产品详情审核
    Route::any('recommand/delete/{id}', ['as' => 'admin.recommand.edit', 'uses' => 'RecommandController@delete']);
    // 产品上线
    Route::get('recommand/online/{id}', ['as' => 'admin.recommand.online', 'uses' => 'RecommandController@online']);
    // 产品下线
    Route::get('recommand/offline/{id}', ['as' => 'admin.recommand.offline', 'uses' => 'RecommandController@offline']);


    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('loading', ['as' => 'admin.loading', 'uses' => 'LoadingController@index']);
    // 产品列表(展示页)
    Route::get('loading/index', ['as' => 'admin.loading.index', 'uses' => 'LoadingController@index']);
    // 新建产品审核
    Route::any('loading/create', ['as' => 'admin.loading.create', 'uses' => 'LoadingController@create']);
    // 修改产品详情审核
    Route::any('loading/delete/{id}', ['as' => 'admin.loading.edit', 'uses' => 'LoadingController@delete']);
    // 产品上线
    Route::get('loading/online/{id}', ['as' => 'admin.loading.online', 'uses' => 'LoadingController@online']);
    // 产品下线
    Route::get('loading/offline/{id}', ['as' => 'admin.loading.offline', 'uses' => 'LoadingController@offline']);

    Route::any('loading/ajaxShengXu', ['as' => 'admin.loading.ajaxShengXu', 'uses' => 'LoadingController@ajaxShengXu']);
    Route::any('loading/ajaxJiangXu', ['as' => 'admin.loading.ajaxJiangXu', 'uses' => 'LoadingController@ajaxJiangXu']);


    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('sms', ['as' => 'admin.sms', 'uses' => 'SmsController@index']);
    // 产品列表(展示页)
    Route::get('sms/index', ['as' => 'admin.sms.index', 'uses' => 'SmsController@index']);
    // 新建产品审核
    Route::any('sms/create', ['as' => 'admin.sms.create', 'uses' => 'SmsController@create']);
    // 修改产品详情审核
    Route::any('sms/delete/{id}', ['as' => 'admin.sms.edit', 'uses' => 'SmsController@delete']);
    // 产品上线
    Route::get('sms/online/{id}', ['as' => 'admin.sms.online', 'uses' => 'SmsController@online']);
    // 产品下线
    Route::get('sms/offline/{id}', ['as' => 'admin.sms.offline', 'uses' => 'SmsController@offline']);

    Route::any('sms/ajaxShengXu', ['as' => 'admin.sms.ajaxShengXu', 'uses' => 'SmsController@ajaxShengXu']);
    Route::any('sms/ajaxJiangXu', ['as' => 'admin.sms.ajaxJiangXu', 'uses' => 'SmsController@ajaxJiangXu']);




    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('smsnew', ['as' => 'admin.smsnew', 'uses' => 'SmsNewController@index']);
    // 产品列表(展示页)
    Route::get('smsnew/index', ['as' => 'admin.smsnew.index', 'uses' => 'SmsNewController@index']);
    // 新建产品审核
    Route::any('smsnew/create', ['as' => 'admin.smsnew.create', 'uses' => 'SmsNewController@create']);
    // 修改产品详情审核
    Route::any('smsnew/delete/{id}', ['as' => 'admin.smsnew.edit', 'uses' => 'SmsNewController@delete']);
    // 产品上线
    Route::get('smsnew/online/{id}', ['as' => 'admin.smsnew.online', 'uses' => 'SmsNewController@online']);
    // 产品下线
    Route::get('smsnew/offline/{id}', ['as' => 'admin.smsnew.offline', 'uses' => 'SmsNewController@offline']);

    Route::any('smsnew/ajaxShengXu', ['as' => 'admin.smsnew.ajaxShengXu', 'uses' => 'SmsNewController@ajaxShengXu']);
    Route::any('smsnew/ajaxJiangXu', ['as' => 'admin.smsnew.ajaxJiangXu', 'uses' => 'SmsNewController@ajaxJiangXu']);



    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('project', ['as' => 'admin.project', 'uses' => 'ProjectController@index']);
    // 产品列表(展示页)
    Route::get('project/index', ['as' => 'admin.project.index', 'uses' => 'ProjectController@index']);
    // 新建产品审核
    Route::any('project/create', ['as' => 'admin.project.create', 'uses' => 'ProjectController@create']);
    // 修改产品详情审核
    Route::any('project/delete/{id}', ['as' => 'admin.project.edit', 'uses' => 'ProjectController@delete']);
    // 产品上线
    Route::get('project/online/{id}', ['as' => 'admin.project.online', 'uses' => 'ProjectController@online']);
    // 产品下线
    Route::get('project/offline/{id}', ['as' => 'admin.project.offline', 'uses' => 'ProjectController@offline']);

    Route::any('project/ajaxShengXu', ['as' => 'admin.project.ajaxShengXu', 'uses' => 'ProjectController@ajaxShengXu']);
    Route::any('project/ajaxJiangXu', ['as' => 'admin.project.ajaxJiangXu', 'uses' => 'ProjectController@ajaxJiangXu']);




   ///-------------------------------------马甲号切换--------------------------------------------------//
        //
    Route::get('deliver', ['as' => 'admin.deliver', 'uses' => 'DeliverController@index']);
    // 产品列表(展示页)
    Route::get('deliver/index', ['as' => 'admin.deliver.index', 'uses' => 'DeliverController@index']);
    // 新建产品审核
    Route::any('deliver/create', ['as' => 'admin.deliver.create', 'uses' => 'DeliverController@create']);
    // 修改产品详情审核
    Route::any('deliver/edit/{id}', ['as' => 'admin.deliver.edit', 'uses' => 'DeliverController@edit']);
    // 产品上线
    Route::get('deliver/online/{id}', ['as' => 'admin.deliver.online', 'uses' => 'DeliverController@online']);
    // 产品下线
    Route::get('deliver/offline/{id}', ['as' => 'admin.deliver.offline', 'uses' => 'DeliverController@offline']);


    //-------------------------------------广告--------------------------------------------------//
    // 产品模块
    Route::get('ad', ['as' => 'admin.ad', 'uses' => 'AdController@index']);
    // 产品列表(展示页)
    Route::get('ad/index', ['as' => 'admin.ad.index', 'uses' => 'AdController@index']);
    // 产品详情展示页
    Route::get('ad/show/{id}', ['as' => 'admin.ad.show', 'uses' => 'AdController@show']);
    // 新建产品审核
    Route::any('ad/create', ['as' => 'admin.ad.create', 'uses' => 'AdController@create']);
    // 修改产品详情审核
    Route::any('ad/edit/{id}', ['as' => 'admin.ad.edit', 'uses' => 'AdController@edit']);
    // 产品上线
    Route::get('ad/online/{id}', ['as' => 'admin.ad.online', 'uses' => 'AdController@online']);
    // 产品下线
    Route::get('ad/offline/{id}', ['as' => 'admin.ad.offline', 'uses' => 'AdController@offline']);

    //-------------------------------------点击数统计--------------------------------------------------//
    // 统计模块
    Route::get('data/product', ['as' => 'admin.data.product', 'uses' => 'DataProductController@index']);
    // 产品列表(展示页)
    Route::get('data/product/index', ['as' => 'admin.data.product.index', 'uses' => 'DataProductController@index']);
    // 昨日的详情
    Route::get('data/product/index', ['as' => 'admin.data.product.index', 'uses' => 'DataProductController@index']);
    Route::get('data/product/lists/{id}', ['as' => 'admin.data.product.lists', 'uses' => 'DataProductController@list']);


    //-------------------------------------点击数统计--------------------------------------------------//
    // 统计模块
    Route::get('data/delivery', ['as' => 'admin.data.delivery', 'uses' => 'DeliveryCountController@index']);
    // 产品列表(展示页)
    Route::get('data/delivery/index', ['as' => 'admin.data.delivery.index', 'uses' => 'DeliveryCountController@index']);
    // 昨日的详情
    Route::get('data/delivery/index', ['as' => 'admin.data.delivery.index', 'uses' => 'DeliveryCountController@index']);
    Route::get('data/delivery/lists/{id}', ['as' => 'admin.data.delivery.lists', 'uses' => 'DeliveryCountController@list']);
    Route::get('data/delivery/lists/today/{id}', ['as' => 'admin.data.delivery.lists.today', 'uses' => 'DeliveryCountController@today']);



    //-------------------------------------用户数统计--------------------------------------------------//
    // 统计模块
    Route::get('data/user', ['as' => 'admin.data.user', 'uses' => 'DataUserController@index']);
    // 产品列表(展示页)
    Route::get('data/user/index', ['as' => 'admin.data.user.index', 'uses' => 'DataUserController@index']);
    // 昨日的详情
    Route::get('data/user/lists/{id}', ['as' => 'admin.data.user.lists', 'uses' => 'DataUserController@list']);
    //excel导出
    Route::get('data/user/excel', ['as' => 'admin.data.user.excel', 'uses' => 'DataUserController@excel']);


//    //-------------------------------------用户市场统计--------------------------------------------------//
//    // 统计模块
    Route::get('channel/user', ['as' => 'admin.channel.user', 'uses' => 'DataChannelController@index']);
//    // 产品列表(展示页)
    Route::get('channel/user/index', ['as' => 'admin.channel.user.index', 'uses' => 'DataChannelController@index']);
    Route::get('channel/user/create', ['as' => 'admin.data.channel.index', 'uses' => 'DataChannelController@index']);

//    // 昨日的详情
    Route::get('channel/user/lists/{id}', ['as' => 'admin.channel.user.index.lists', 'uses' => 'DataChannelController@list']);
    //excel导出
    Route::get('channel/user/excel', ['as' => 'admin.channel.user.excel', 'uses' => 'DataChannelController@excel']);

    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('vip', ['as' => 'admin.vip', 'uses' => 'VipController@index']);
    // 产品列表(展示页)
    Route::get('vip/index', ['as' => 'admin.vip.index', 'uses' => 'VipController@index']);
    // 新建产品审核
    Route::any('vip/create', ['as' => 'admin.vip.create', 'uses' => 'VipController@create']);
    // 修改产品详情审核
    Route::any('vip/delete/{id}', ['as' => 'admin.vip.edit', 'uses' => 'VipController@delete']);
    // 产品上线
    Route::get('vip/online/{id}', ['as' => 'admin.vip.online', 'uses' => 'VipController@online']);
    // 产品下线
    Route::get('vip/offline/{id}', ['as' => 'admin.vip.offline', 'uses' => 'VipController@offline']);

    //-------------------------------------马甲号切换--------------------------------------------------//
    //
    Route::get('carousel', ['as' => 'admin.carousel', 'uses' => 'CarouselController@index']);
    // 产品列表(展示页)
    Route::get('carousel/index', ['as' => 'admin.carousel.index', 'uses' => 'CarouselController@index']);
    // 新建产品审核
    Route::any('carousel/create', ['as' => 'admin.carousel.create', 'uses' => 'CarouselController@create']);
    // 修改产品详情审核
    Route::any('carousel/delete/{id}', ['as' => 'admin.carousel.delete', 'uses' => 'CarouselController@delete']);
    Route::any('carousel/edit/{id}', ['as' => 'admin.carousel.edit', 'uses' => 'CarouselController@edit']);

    // 产品上线
    Route::get('carousel/online/{id}', ['as' => 'admin.carousel.online', 'uses' => 'CarouselController@online']);
    // 产品下线
    Route::get('carousel/offline/{id}', ['as' => 'admin.carousel.offline', 'uses' => 'CarouselController@offline']);

    //--------------------------------------设置管理----------------------------------------------------//



    //安稳号账户列表
    Route::any('shayuhao', ['as' => 'admin.shayuhao', 'uses' => 'ShayuController@index']);
    //安稳号账户列表
    Route::any('shayuhao/index', ['as' => 'admin.shayuhao.index', 'uses' => 'ShayuController@index']);
    //安稳号账户详情
    Route::any('shayuhao/detail', ['as' => 'admin.shayuhao.detail', 'uses' => 'ShayuController@detail']);
    //创建安稳号账户
    Route::any('shayuhao/create', ['as' => 'admin.shayuhao.create', 'uses' => 'ShayuController@create']);
    //安稳号账户修改
    Route::any('shayuhao/edit', ['as' => 'admin.shayuhao.edit', 'uses' => 'ShayuController@edit']);
    //安稳号账户修改操作
    Route::any('shayuhao/update/{id}', ['as' => 'admin.shayuhao.update', 'uses' => 'ShayuController@update']);




    // 默认欢迎页面
    Route::any('setting/welcome', ['as' => 'admin.setting.welcome', 'uses' => 'SettingController@welcome']);



});

Route::get('/', function () {
    return redirect('/admin/index');
});

